Skip to content

Fix the Windows IPA build handoff - #182

Merged
v0lumehi merged 10 commits into
LNPANDY:mainfrom
tmrsm:windows-ipa-build
Nov 3, 2026
Merged

v0lumehi merged 10 commits into
LNPANDY:mainfrom
tmrsm:windows-ipa-build

Conversation

@tmrsm

@tmrsm tmrsm commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What and why

The experimental Windows IPA build stopped at several handoffs: the link probe referenced an undefined environment, the translator shim referenced an undefined module, the upstream toolchain callback gained arguments, portable .NET and SPIRV-Cross paths were not passed to child processes, and image-backed RomFS data was treated as a folder.

Fix those handoffs, validate the RomFS marker through the image reader, and embed an image as romfs.img. Preserve an explicitly selected SPIRV-Cross. The README records the observed device result and the remaining manual steps; this does not claim the unmodified frontend is ready for all games.

Two smaller changes came in with the same checkout and are not part of the handoff fix: the uv test now passes USERPROFILE through explicitly, and two read_text calls name encoding='utf-8'.

The image-reader and shader-label fixes needed by the build are proposed upstream in seedds/nxnative#591 and must be synced before this becomes an end-to-end path on an unmodified checkout. The successful local build also used manually materialized SDK links, an updated dmsh_chain.lock with a regenerated DMSH_CHAIN, and a two-line declaration of CMMotionManager.deviceMotionBody for the iPhoneOS26.0 SDK the Windows toolchain ships; those machine-specific changes are not part of this PR.

Checked

  • Five targeted Windows frontend tests pass, including the real child-process translator mapping, explicit tool selection, and the updated toolchain callback. The actual Windows iOS compile, link and Metal probes also passed.
  • test_win.py on ecdc92e from a clean worktree: 133 tests, 2 failures, 3 errors, 2 skipped. After merging current main into this branch (0ac7699): 131 tests, 1 failure, 11 errors, 3 skipped. The remaining failure is test_metal_tt_has_no_windows_tool, which fails identically on main on this machine (the installed Metal Developer Tools ship metal-tt.exe), so it is not caused by this change; test_check_prereqs_raises_with_a_report no longer fails on current main. The errors are local: PySide6 QtCore fails to load on this machine, and the unmerged engine tree is not synced in that run. The same machine also fails test_i18n_detect (3) and test_ascii_temp (1) on an unmodified main.
  • A Rhythm Heaven Groove 1.0.0 (0100D9F01D474000) IPA built on Windows with this branch, Support RomFS image readers on Windows seedds/nxnative#591, the lock update and the SDK shim installed and launched on an iPhone Air running iOS 27.0.1; Play started the game, which showed 60 FPS on the app's own frame-rate counter (no frame-time measurements were taken), with correct button mappings.
  • swift test and Mac visual QA were not run: no Mac was available and this change does not alter the UI.

Scope

  • No vendored file is edited; the related upstream change is linked above.
  • No keys, game files or data extracted from a game are included.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The stage key still fingerprints SPIRV-Cross from PATH rather than the executable selected by SPIRV_CROSS, allowing compiler changes to reuse stale shader libraries without compiler checks.

1 open issue
What changed in this PR

Fixes several handoffs in the Qt frontend’s experimental Windows IPA build path. End-to-end support still depends on upstream fixes and manual setup.

Changes:

  • Fixes linker and translator probes, passes portable tool paths to child processes, and updates the toolchain callback signature.
  • Validates image-backed RomFS data and packages it as romfs.img.
  • Adds targeted regression tests and documents reported device results and remaining limitations.
File Description
frontend-qt/​tests/​test_win.py Adds probe, environment, translator, and callback regression coverage.
frontend-qt/​README.md Clarifies experimental status, reported gameplay, and manual prerequisites.
frontend-qt/​nspb_qt/​win/​toolchain.py Removes the undefined environment reference from the link probe.
frontend-qt/​nspb_qt/​win/​shim.py Resolves the translator’s toolchain import and propagates selected tool paths.
frontend-qt/​nspb_qt/​win/​driver.py Accepts the upstream toolchain callback arguments.
frontend-qt/​nspb_qt/​win/​build_app.py Supports RomFS image validation and IPA packaging.

Review effort: Balanced


# ---------------------------------------------------------------- the shader cache key
def toolchain_probe():
def toolchain_probe(repo_=None, env=None):
@v0lumehi

Copy link
Copy Markdown
Collaborator

Thanks for working through the Windows handoffs. Could you rebase onto current main? It is 53 commits ahead now, and frontend-qt/nspb_qt/win/toolchain.py conflicts, since the link probe was reworked in #192 and #196. Please also look at Copilot's open finding: the stage key should fingerprint the SPIRV-Cross that SPIRV_CROSS selects, not the one on PATH, or a changed compiler reuses stale shader libraries. The upstream half is still seedds/nxnative#591, we'll note here when it is synced.

tmrsm and others added 3 commits October 30, 2026 07:47
The Windows toolchain probe ran `spirv-cross --revision` from PATH while
build_env() passes an explicit SPIRV_CROSS. Switching the selected compiler
could therefore leave the shader-stage key unchanged and reuse libraries
from the previous compiler.

Resolve the selected executable through the upstream spirv_cross(repo, env)
resolver and return it as a files entry, so the stage key hashes the compiler
that is actually used. Add a regression test that changing SPIRV_CROSS (or
the executable's contents) changes the key.

Also keep a linker that cannot start as a reported link-probe result, and
make the new upstream source-reading and uv-home tests portable on Windows
(UTF-8 reads, USERPROFILE).
@tmrsm
tmrsm force-pushed the windows-ipa-build branch from f4559d0 to ecdc92e Compare October 29, 2026 23:54
@v0lumehi v0lumehi added windows Windows (the Qt front end) bug Something isn't working labels Oct 30, 2026
@LNPANDY

LNPANDY commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Thanks for the Windows fixes and for adding coverage for the selected SPIRV-Cross fingerprint. I reviewed the current head ecdc92e: the import fix and fingerprint work look useful, but we cannot yet treat the full path as verified. The latest head has no reported CI checks, and the earlier working IPA used additional local changes, including a Windows-specific tool fingerprint.

The RomFS image path also depends on the Windows pread and path handling being resolved (seedds/nxnative#591 is still open), and #206 touches some of the same Windows build files with separate link-probe changes. We will coordinate those pieces rather than close or duplicate your contribution. Could you share an updated test report on the current head, including the Windows toolchain-lock setup, the complete test_win.py result, and whether an IPA built without uncommitted patches installs and runs on a device? Please do not attach keys or game-derived files.

@tmrsm

tmrsm commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Re-ran the three checks on ecdc92e from a clean worktree. Result: the head cannot produce a Windows IPA as it stands; the blockers are the ones you named plus one new SDK issue.

1. Windows toolchain-lock setup

  • SPIRV-Cross is %LOCALAPPDATA%\NS Port Builder\tools\spirv-cross-1.4.363.0\spirv-cross.exe, sha256[:16] 74785b6e637ba564, built from the pinned upstream commit. The committed lock records the macOS build e37945d8e441d34d.
  • With that tool selected, dmsh_build.py reports exactly one mismatch (spirv-cross). The translator dll/source digests and both Metal entries match the committed lock on this machine (the Metal Developer Tools report Apple metal version 32023.921 (metalfe-32023.921.6) through the Windows xcrun shim).
  • tool_lock.py --update-lock + dmsh_chain.py --header give DMSH_CHAIN=7305eaa36ca1 (head: f3ceca86cac5). Those two files remain outside the PR.

2. test_win.py, head ecdc92e, clean worktree

Ran 133 tests in 8.694s — FAILED (failures=2, errors=3, skipped=2)

  • 3 errors: PySide6 QtCore DLL load failure on this machine (one further skip for the same reason).
  • test_metal_tt_has_no_windows_tool: the installed Metal Developer Tools do ship metal-tt.exe.
  • test_check_prereqs_raises_with_a_report: with the toolchain present, check_prereqs reports the translator path first ("the shader translator is missing from the repository: missing\dmsh_xlate") before reaching "missing on this PC".
  • Other skip: macOS only.

3. Build and device

  • Clean checkout, no patches: profile_guess.build_sources → FileNotFoundError: ...\extract\v0\RomFS.img\graph (dm/tools/romfs.py:147) — the image-backed RomFS case Custom launch controls: keyboard and accessibility semantics #591 fixes. No IPA.
  • Head + cherry-pick of e393a93 (Custom launch controls: keyboard and accessibility semantics #591) + lock update: dm/ios/Sources/DmGamepad.m:94: error: property 'deviceMotionBody' not found on object of type 'CMMotionManager *'. The current main uses the iOS 27 motion-body API, but the Windows toolchain here has only iPhoneOS26.0.sdk and sdk_fetch.py can only extract a SDK from an Xcode .xip. A two-line declaration shim (the call itself stays behind @available(iOS 27, *)) lets it compile — a third delta that is not in the PR.
  • With those three deltas the IPA builds: 27,315,872 bytes, 166 entries, no embedded RomFS, CRC ok.
  • Installed through AltStore 2.3.2 on the iPhone Air (iPhone18,4, iOS 27.0.1). Same Apple ID/team, updates in place (org.nxnative.0100d9f01d474000.8VYJTT8RA9). It launches: boot: game files .../Documents/romfs.img, launcher: 13 settings shown, and Play starts the game. Game data (3,408,853,800 bytes) lives in Documents/romfs.img; the existing save survived.
  • Frame times were not measured.

@v0lumehi

v0lumehi commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Thanks, the code changes look right to me. I checked them against current main: the PR merges cleanly now (it is only BEHIND), so the earlier conflict note no longer applies.

What I checked and agree with:

  • shim.py: tc is not defined inside the generated sitecustomize, so tc.dotnet_dir() would fail there. import toolchain as tc in the child fixes that.
  • driver.py: toolchain_probe(repo_, env) matches the engine's toolchain(repo, env=None), and the stage key now follows the executable SPIRV_CROSS selects. That closes Copilot's open finding, and the test also covers changed contents at the same path.
  • build_app.py: the romfs.img embed and its --skip entry are consistent.
  • DOTNET_ROOT / SPIRV_CROSS with setdefault keeps an explicitly chosen path.

Three things before this can go in:

  1. README, "60 FPS". The text says the IPA ran at 60 FPS with correct button mappings, but your last comment says frame times were not measured. Please drop the 60 FPS claim, or reword it to what you did observe (it launched and Play started the game). It should also say that this IPA needed three local changes: Support RomFS image readers on Windows seedds/nxnative#591, a lock update and the iOS 27 SDK shim for deviceMotionBody.
  2. No CI on the head. Please update the branch onto current main so the checks run.
  3. Two failing tests. On your machine test_metal_tt_has_no_windows_tool and test_check_prereqs_raises_with_a_report fail. Do they also fail on main on the same machine? If yes, please say so in the PR. If not, they come from this change.

Smaller point: the USERPROFILE change in the uv test and encoding='utf-8' in two read_text calls are not part of the handoff fix. They are fine to keep, but please name them in "What and why".

Without seedds/nxnative#591 the build still stops at RomFS.img\graph, so this stays experimental until that is synced. The README already says so, apart from the 60 FPS line.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Nov 1, 2026
@v0lumehi v0lumehi added the nice-to-have Goes into the next release if it is ready in time label Nov 1, 2026
@v0lumehi v0lumehi modified the milestones: v1.1.1, v1.1.0 Nov 1, 2026
build_app.py: move the RomFS marker check, the romfs/romfs.img name and the
pack skip list into small helpers and cover them with RomfsPackTest, which
runs on every platform. README says the game started, without a frame rate.
shim.py: spirv-cross env line on two lines.
@v0lumehi
v0lumehi merged commit 30116a8 into LNPANDY:main Nov 3, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation nice-to-have Goes into the next release if it is ready in time windows Windows (the Qt front end)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants